<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<c:set var="serviceurl" value="${ctx}/price" />
<html>
<head>
</head>
<body>
	<div class="container-fluid rap-select-container" id="rap-container-list">
		<div class="row-fluid">
			<table id="tableList" class="table table-striped table-bordered table-hover">
				<thead>
					<tr>
						<th><input type="checkbox" /> <span class="lbl"></span></th>
						<th>价格公布时间</th>
						<th>区域</th>
						<th>用途</th>
						<th>价格</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
				</tbody>
			</table>
		</div>
	</div>
	
	<script type="text/javascript">
		//变量定义
		var _tableList, _queryData, _detailRecord, _detailRecordIdx, _validator;
		var _tableCols = [{
						data : "uuid",
						orderable : false,
						className : "center",
						width : "30",
						render : RapDataTableUtils.renderCheckCol
					},
					{
						data : 'publicTime',
						width : "120",
						//render : function(data, type, full){},
						orderable : true
					},
					{
						data : 'area',
						width : "120",
						//render : function(data, type, full){},
						orderable : true
					},
					{
						data : 'usefor',
						width : "120",
						//render : function(data, type, full){},
						orderable : true
					},
					{
						data : 'price',
						width : "120",
						//render : function(data, type, full){},
						orderable : true
					},
					{
						data : "uuid",
						className : "center",
						orderable : false,
						render : function(data, type, full){
							return "<div class='rap-btn-actiongroup'>" 
							+ "<button id='selectBtn' class='btn btn-xs btn-info' data-rel='tooltip' title='选择'>选择</button>"
							+ "</div>";
						},
						width : "80"
					}];
									
		//加载表格数据
		function loadList() {
			$.ajax({
				url : '${serviceurl}/query?search_EQ_priceType=${priceType}',
				data : _queryData,
				dataType : 'json',
				success : function(data) {
					_tableList.clear();
					_tableList.rows.add(data.records);
					_tableList.draw();
				}
			});
		}
		function callBackParent(data){
			//调用传递过来的callback方法
			window.parent.${callback}(data);
			window.parent.$.colorbox.close();
		}
		$(document).ready(function() {
			_tableList = $('#tableList').DataTable({
				stateSave : true,
				columns : _tableCols,
				createdRow : function(nRow, aData, iDataIndex){
					$(nRow).dblclick(function() {
						//调用传递过来的callback方法
						callBackParent(data);
					});
					$("#selectBtn",nRow).click(function() {
						callBackParent(aData);
					});
				}
			});
			RapDataTableUtils.setCheckCol(_tableList);
			loadList();
		});
	</script>
</body>
</html>
